/**
 * 
 */
package com.sci.web.action.register;

import javax.annotation.Resource;

import com.sci.web.action.util.BaseAction;
import com.sci.web.dao.UserRegisterDao;

/**
 * @author  BaiFuyou
 * @date: Sep 29, 2011 11:42:47 AM
 * 
 * 验证企业填写的用户名是否已经存在
 */
public class IsEnterpriseNameExistAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4517173916651034663L;
	@Resource
	private UserRegisterDao registerdao;
	private String name ;
	/**
	 * @return the name
	 */
	@com.googlecode.jsonplugin.annotations.JSON(serialize = false)
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		super.setContentType(super.JSON);
//		System.out.println(name+"=name");
		if(registerdao.isEnterpriseNameExist(name)){
			super.outPrint("ok");
		}else{
			super.outPrint("fail");
		}
		return "json";
	}

}
